﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Halide
{
	/// <summary>
	/// The DataCon class is used as a way to pass database information to a DataRow class object
	/// for opening and reading a row from a database. This class is instantiated and given values
	/// for properties like ConnectionName, TableName, PrimaryKeyName, PrimaryKeyValue, and more,
	/// and the variable is passed as an instantiation parameter to the DataRow class.
	/// </summary>
	public class DataCon
	{
		private static string _version = "2008.06.21A";

		/// <summary>
		/// Return the version number of the class; read-only.
		/// </summary>
		/// <value>
		/// String version number of the class.
		/// </value>
		public static string Version
		{
			get
			{
				return _version;
			}
		}

		private string _ConnectionName = "Halide";

		private string _PrimaryKeyName = "";

		private string _PrimaryKeyValue = "";

		private string _TableName = "";

		private string _SQLCommand = "";

		/// <summary>
		/// Set the connection string name to use from within the web.config file.
		/// The default connection is "Halide".
		/// </summary>
		public string ConnectionName
		{
			get
			{
				return _ConnectionName;
			}

			set
			{
				_ConnectionName = value;
			}
		}

		/// <summary>
		/// The name of the primary key column in the table to read.
		/// </summary>
		public string PrimaryKeyName
		{
			get
			{
				return _PrimaryKeyName;
			}

			set
			{
				_PrimaryKeyName = value;
			}
		}

		/// <summary>
		/// The value of the primary key in the row to be read.
		/// </summary>
		public string PrimaryKeyValue
		{
			get
			{
				return _PrimaryKeyValue;
			}

			set
			{
				_PrimaryKeyValue = value;
			}
		}

		/// <summary>
		/// The name of the table from which to read a row of data.
		/// </summary>
		public string TableName
		{
			get
			{
				return _TableName;
			}

			set
			{
				_TableName = value;
			}
		}

		/// <summary>
		/// SQL statement to execute, for reading a row from a specific table.
		/// This statement overrides all other parameters.
		/// </summary>
		public string SQLCommand
		{
			get
			{
				return _SQLCommand;
			}

			set
			{
				_SQLCommand = value;
			}
		}
	}
}
